﻿#include "stdafx.h"
#include <cstdint>
#include <string>
#include <typeindex>
#include <memory>
#include <llvm/IR/LLVMContext.h>

#include "AstConstant.h"
#include "AstType.h"
#include "SIntegerType.h"
#include "CodeGenerate/IntegerGen.h"

using namespace llvm;

CodeGen * AstConstant::makeGen(SiContext * parent)
{
	return new IntegerGen(_value, _bits);
}

void AstConstant::set_value(bool v)
{
	_bits = 1;
	_value = v ? 1 : 0;
}

void AstConstant::set_value(int32_t v)
{
	_bits = 32;
	_value = v;
}

void AstConstant::set_value(int64_t v)
{
	_bits = 64;
	_value = v;
}

